﻿package ywh.list
{
	import ywh.manager.Tag;
	import ywh.utils.TimeFormat;
	import ywh.utils.XMLUtils;
	
	/**
	 * 从流内容
	 * @author 杨伟华
	 * @version 2.0
	 *
	 * Created 1/21/2013 2:14 AM
	 */
	public class FollowList extends MediaList
	{
		
		public function FollowList()
		{
			super();
		}
		
		/**
		 * 检测加入列表;
		 * @param	xml
		 * @return
		 */
		override protected function parseXML(xml:XML):Boolean
		{
			var result:Boolean = false;
			var mainId:Number = XMLUtils.getPropNumber(xml, Tag._M);
			var mainPos:Number = TimeFormat.hhmmss2ss(XMLUtils.getPropString(xml, Tag._T));
			if (isNaN(mainId) && isNaN(mainPos))
			{
				return false;
			}
			else
			{
				mainPos ||= 0;
				if (isNaN(mainId))
				{
					mainId = (count - 1) < 0 ? 0 : XMLUtils.getPropNumber(_courseItems[count - 1], Tag._M);
				}
				xml[Tag._M] = String(mainId);
				xml[Tag._T] = String(mainPos);
				xml[Tag._START_TIME] = String(MainList.$.getItemStartTime(mainId) + mainPos);
				_courseItems.push(xml);
				return true;
			}
		}
		override protected function initCourseItemsList():void 
		{
			super.initCourseItemsList();
			_totalDuration = MainList.$.totalDuration;
		}
	}

}